/*
{
"状态":1,
"名称":"获取-供应商列表",
"作者":"马学兵",
"创建时间":"2018-08-02",
"功能":"获取-供应商列表",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/
declare @sql nvarchar(max)
declare @supplier_name varchar(100)
declare @where varchar(max)
 
set @supplier_name = '{supplier_name}'
set @where = ''

if(@supplier_name <>'')
BEGIN
	SET @supplier_name='%'+@supplier_name+'%'
	set @where += ' and (supplier_name like @supplier_name  or supplier_no like @supplier_name or simple_code like @supplier_name)'
end

SET @sql = 'select Top 50 supplier_id, supplier_name from b_supplier where 1 = 1 '

SET @sql+=@where
EXEC sp_executesql @sql,N'@supplier_name varchar(100)',@supplier_name
 